package smb.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

@Data
@AllArgsConstructor
public class StudentScore {
    private StudentVo student;
    private ScoreVo score;

    public static class rowMapper implements RowMapper<StudentScore> {
        @Override
        public StudentScore mapRow(ResultSet resultSet, int i) throws SQLException {
            StudentVo studentVo = new StudentVo(resultSet.getString(1), resultSet.getString(2), resultSet.getString(3));
            ScoreVo scoreVo = new ScoreVo(resultSet.getDouble(4), resultSet.getDouble(5), resultSet.getDouble(6), resultSet.getDouble(7), resultSet.getDouble(8), resultSet.getTimestamp(9));
            return new StudentScore(studentVo, scoreVo);
        }
    }
}
